/*
 * @lc app=leetcode.cn id=119 lang=typescript
 *
 * [119] 杨辉三角 II
 */

// @lc code=start
function getRow(rowIndex: number): number[] {
    const res = [[1], [1, 1]];
    if (rowIndex < 2) {
        return res[rowIndex];
    }
    for (let i = 2; i < rowIndex + 1; i++) {
        const arr: any = [];
        arr.push(1);
        for (let j = 0; j < res[i - 1].length - 1; j++) {
            arr.push(res[i - 1][j] + res[i - 1][j + 1])
        }
        arr.push(1);
        res.push(arr);
    }
    return res[rowIndex]
};

// @lc code=end

